Sickle - SECCON 2023
code:python
flag = input("FLAG> ").encode()
exit()
flag_parts = [int.from_bytes(flagi*8:i*8+8, 'little') for i in range(8)] enc = []
key = 1244422970072434993
for flag_part in flag_parts:
key = pow(flag_part ^ key, 65537, 18446744073709551557)
enc.append(key)
print("Congratulations!!")
else:
print("Nope")
powとxorを組み合わせた暗号アルゴリズムが使われており、encから逆向きに計算することでflagが得られた。
code:python
p = 18446744073709551557
e = 65537
d = pow(e, -1, p - 1)
def decode(c, key):
return pow(c, d, p) ^ key
flag = ''
key = 1244422970072434993
for i in range(len(enc)):
flag += int.to_bytes(decode(enci, key), 8, 'little').decode() print(flag)